package com.chazz.dao.impl;

import com.chazz.dao.CartDao;
import com.chazz.dao.GoodDao;
import com.chazz.dao.GoodsDao;
import com.chazz.entity.Cart;
import com.chazz.entity.Goods;
import com.chazz.utils.DBUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class GoodDaoImpl extends GenericDaoImpl<Goods,Integer> implements GoodDao {
    @Override
    public Goods findCartByCartSid(Integer goodgid) {
        Goods good = null;
        String sql = "SELECT * FROM Goods WHERE goodsid=?";
        ResultSet rs = DBUtils.executeQuery(sql,goodgid);
        try{
            while(rs.next()){
                good = reflectUtils.newInstance(Goods.class,rs);
            }
        }catch (SQLException ex){
            ex.printStackTrace();
        }
        return good;
    }

}
